﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NetDiskPRJ.Model
{
    /// <summary>
    /// 导出excel的实体
    /// </summary>
    [Serializable]
    public class XlsModel
    {
        public XlsModel()
        {

        }
        public int RowIndex { get; set; }
        /// <summary>
        /// 文字
        /// </summary>
        public string Title { get; set; }

        private int _rowspan = 1;
        /// <summary>
        /// 行合并
        /// </summary>
        public int RowSpan
        {

            set
            {
                _rowspan = value;
            }
            get
            {
                return _rowspan;
            }

        }

        private int _colspan = 1;
        /// <summary>
        /// 列合并
        /// </summary>
        public int ColSpan
        {
            set
            {
                _colspan = value;
            }
            get
            {
                return _colspan;
            }
        }
        private HorizontalAlign _halign = HorizontalAlign.Left;
        /// <summary>
        /// 水平对齐方式
        /// </summary>
        public HorizontalAlign HAlign
        {
            set
            {
                _halign = value;
            }
            get
            {
                return _halign;
            }

        }

        private ContentType _titleType = ContentType.String;
        /// <summary>
        /// 文字类型
        /// </summary>
        public ContentType TitleType
        {
            set
            {
                _titleType = value;
            }
            get
            {
                return _titleType;
            }
        }
        #region 边框样式
        private bool _userBorder = true;
        /// <summary>
        /// 是否使用边框
        /// </summary>
        public bool UseBorder
        {
            set
            {
                _userBorder = value;
            }
            get
            {
                return _userBorder;
            }
        }
        private ushort _topLineStyle = 1;
        /// <summary>
        /// 上边框样式
        /// </summary>
        public ushort TopLineStyle
        {
            set
            {
                _topLineStyle = value;
            }
            get
            {
                return _topLineStyle;
            }
        }
        private ushort _buttomLineStyle = 1;
        /// <summary>
        /// 下边框样式
        /// </summary>
        public ushort BottomLineStyle
        {
            set
            {
                _buttomLineStyle = value;
            }
            get
            {
                return _buttomLineStyle;
            }
        }
        private ushort _leftLineStyle = 1;
        /// <summary>
        /// 左边框样式
        /// </summary>
        public ushort LeftLineStyle
        {
            set
            {
                _leftLineStyle = value;
            }
            get
            {
                return _leftLineStyle;
            }
        }
        private ushort _rightLineStyle = 1;
        /// <summary>
        /// 右边框样式
        /// </summary>
        public ushort RightLineStyle
        {
            set
            {
                _rightLineStyle = value;
            }
            get
            {
                return _rightLineStyle;
            }
        }
        #endregion
        private bool _userPatternColor = false;
        /// <summary>
        /// 是否使用背景色
        /// </summary>
        public bool UserPatternColor
        {
            set
            {
                _userPatternColor = value;
            }
            get
            {
                return _userPatternColor;
            }
        }
        /// <summary>
        /// 背景颜色
        /// </summary>
        public PatternColor PColor { get; set; }
        public enum PatternColor
        {
            no = 0,
            Silver = 1,
            Yellow = 2,
            Red = 3,
            Blue = 4,
            Purple = 5,
            Grey = 6
        }
        /// <summary>
        /// 垂直对齐方式
        /// </summary>
        public VerticalAlign VAlign { get; set; }

        public enum VerticalAlign
        {
            // 摘要:
            //     未设置垂直对齐方式。
            NotSet = 0,
            //
            // 摘要:
            //     文本或对象与该封闭控件的顶部对齐。
            Top = 1,
            //
            // 摘要:
            //     文本或对象与该封闭控件居中对齐。
            Middle = 2,
            //
            // 摘要:
            //     文本或对象与该封闭控件的底部对齐。
            Bottom = 3,
        }

        // 摘要:
        //     指定容器中的项的水平对齐方式。
        public enum HorizontalAlign
        {
            // 摘要:
            //     未设置水平对齐方式。
            NotSet = 0,
            //
            // 摘要:
            //     容器的内容左对齐。
            Left = 1,
            //
            // 摘要:
            //     容器的内容居中。
            Center = 2,
            //
            // 摘要:
            //     容器的内容右对齐。
            Right = 3,
            //
            // 摘要:
            //     容器的内容均匀展开，与左右边距对齐。
            Justify = 4,
        }
        /// <summary>
        /// 内容类型
        /// </summary>
        public enum ContentType
        {
            /// <summary>
            /// 字符串
            /// </summary>
            String = 0,
            /// <summary>
            /// 数字
            /// </summary>
            Number = 1

        }

    }


    /// <summary>
    /// 导出excel的实体列
    /// </summary>
    [Serializable]
    public class XlsModel_Column
    {
        public XlsModel_Column()
        {

        }

        private ushort _columnIndexStar = 0;
        /// <summary>
        /// 开始列
        /// </summary>
        public ushort ColumnIndexStart
        {
            set
            {
                _columnIndexStar = value;
            }
            get
            {
                return _columnIndexStar;
            }
        }

        private ushort _columnIndexEnd = 0;
        /// <summary>
        /// 结束列
        /// </summary>
        public ushort ColumnIndexEnd
        {
            set
            {
                _columnIndexEnd = value;
            }
            get
            {
                return _columnIndexEnd;
            }
        }

        private ushort _width = 0;
        /// <summary>
        /// 列宽,直接输入整数型的excel实际数字
        /// 列的宽度计量单位为 1/256 字符宽
        /// </summary>
        public ushort Width
        {
            set
            {
                _width = value;
            }
            get
            {
                return ushort.Parse((_width * 256).ToString());
            }
        }
    }


    /// <summary>
    /// 导出excel的实体行
    /// </summary>
    [Serializable]
    public class XlsModel_Row
    {
        public XlsModel_Row()
        {

        }
        private ushort _rowHeight = 0;
        /// <summary>
        /// 行高,直接输入整数型的excel实际数字
        /// 行的高度计量单位为 1/20 字符宽
        /// </summary>
        public ushort RowHeight
        {
            set
            {
                _rowHeight = value;
            }
            get
            {
                return ushort.Parse((_rowHeight * 20).ToString());
            }
        }
        private ushort _rowIndexStart = 0;
        /// <summary>
        /// 开始行
        /// </summary>
        public ushort RowIndexStart
        {
            set
            {
                _rowIndexStart = value;
            }
            get
            {
                return _rowIndexStart;
            }
        }

        private ushort _rowIndexEnd = 0;
        /// <summary>
        /// 结束行
        /// </summary>
        public ushort RowIndexEnd
        {
            set
            {
                _rowIndexEnd = value;
            }
            get
            {
                return _rowIndexEnd;
            }
        }
    }



    /// <summary>
    /// excel标题样式
    /// </summary>
    [Serializable]
    public class ExcelTitleFont
    {
        /// <summary>
        /// 字体名称
        /// </summary>
        public string FontName
        {
            set;
            get;
        }
        private int _fontsize = 1;
        /// <summary>
        /// 字体大小（字体大小是以 1/20 point 为单位的）
        /// </summary>
        public int FontSize
        {
            set
            {
                _fontsize = value;
            }
            get
            {
                return _fontsize * 20;
            }
        }
        /// <summary>
        /// 是否加粗
        /// </summary>
        public bool Bold
        {
            set;
            get;
        }
    }
}
